<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="entity.Visitor"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
    Visitor visitor = null;
    try{    	
    	visitor = (Visitor)session.getAttribute("curSession");
    	if (visitor == null ) {
    		response.sendRedirect("login.jsp");
    	}
    }catch(Exception ex){
        System.out.println(" home page says: " + ex.getMessage());
    }
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title> Add new tour </title>
    <link href="css/java_tech_css.css" rel="stylesheet" type="text/css"/>
	<script type="text/javascript" src="js/jquery-1.9.0.js"></script>	
	<script type="text/javascript" src="js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="js/messages_vi.js"></script>
</head>
<body>
	<div id="container">
		<div class="visitor-info">
			<h3>Add Tour</h3>
		</div>
		<div class="content">
			<div class="form">
				<form action="addtour" method="post" name="formAddTour" id="addTourForm" 
				    onsubmit="return checkAll();">
				<div class="row">
					<div class="col1">
						<p>Tour name :</p>
					</div>
					<div class="col2">
						<input type="text" name="tourName" id="tourName"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Place :</p>
					</div>
					<div class="col2">
						<input type="text"  name="place" id="place"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Start Date:</p>
					</div>
					<div class="col2">
						<input type="text" name="startDate" id="startDate"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>End Date :</p>
					</div>
					<div class="col2">
						<input type="text" name="endDate" id="endDate"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Price :</p>
					</div>
					<div class="col2">
						<input type="text" name="price"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Image :</p>
					</div>
					<div class="col2">
						<input type="text" name="images"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Number of visitors :</p>
					</div>
					<div class="col2">
						<input type="text" name="maxVisitors"/>
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Number of current visitors :</p>
					</div>
					<div class="col2">
						<input type="text" name="currentVisitors" />
					</div>
				</div>
				<div class="row">
					<div class="col1">
						<p>Tag :</p>
					</div>
					<div class="col2 area">
						<input type="text" name="tag" />
					</div>
					<div class="clear"></div>
				</div>
				<div class="btn-add">
					<input type="submit" value="Add Tour">
				</div>				
				<span class="error"> <s:actionerror/> </span>
				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	$(document).ready(function(){
		$("#addTourForm").validate({
	        rules: {
	        	tourName: {
	    	  		required: true,
	    	  		maxlength: 50
	    	  	},
	    	  	place: {
	    	  		required: true,
	    	  		maxlength: 100
	    	  	},	
	    	  	startDate: {
					required: true,
					date: true
				},
				endDate: {
	    	  		required: true,
	    	  		date: true
	    	  	},
	    	  	price: {
	    	  		required: true,
	    	  		number: true
	    	  	},
	    	  	maxVisitors: {
	    	  		required: true,
	    	  		number: true
	    	  	},
	    	  	currentVisitors: {
	    	  		required: true,
	    	  		number: true
	    	  	},
	        }, 
	        messages: {
	        	tourName: {
	    	  		required: "This field is required",
	    	  		maxlength: "Tour name is not more than 50 characters"
	    	  	},
	    	  	place: {
	    	  		required: "This field is required",
	    	  		maxlength: "Place is not more than 50 characters"
	    	  	},	
	    	  	startDate: {
					required: "This field is required",
					date: "Enter start date as format mm/dd/yyyy"
				},
				endDate: {
	    	  		required: "This field is required",
	    	  		date: "End start date as format mm/dd/yyyy"
	    	  	},
	    	  	price: {
	    	  		required: "This field is required",
	    	  		money: "Enter only digits"
	    	  	},
	    	  	maxVisitors: {
	    	  		required: "This field is required",
	    	  		number: "Enter only digits"
	    	  	},
	    	  	currentVisitors: {
	    	  		required: "This field is required",
	    	  		number: "Enter only digits"
	    	  	},
	        }
	    }); 
	});
</script>
</body>
</html>